EdgeRouter: IPv4 PPPoE接続を再追加してDynamic DNSを設定
(このページは工事中です)
参照ページ
条件
Ubiquiti EdgeRouter ER-X
Asahi-Net
Flets'光
PPPoEの再追加
PPPoEを設定:
set interfaces ethernet eth0 pppoe 0 user-id <Asahiネットid>@atson.net
set interfaces ethernet eth0 pppoe 0 password <Asahiネットパスワード>
set interfaces ethernet eth0 pppoe 0 mtu 1454 # 1454はフレッツ光の場合
set interfaces ethernet eth0 pppoe 0 default-route none # デフォルトルートはDS-Liteに向けたままにする。
set interfaces ethernet eth0 pppoe 0 name-server auto
PPPoE接続用のファイアウォール設定:
set firewall name PPPoE_IN default-action drop # PPPoE_INチェインのデフォルトはパケットの破棄。
set firewall name PPPoE_IN description 'IPv4 PPPoE to LAN' # GUIに表示されるチェインの説明。
set firewall name PPPoE_IN enable-default-log # デフォルトアクションのログをとる。
set firewall name PPPoE_IN rule 10 action accept
set firewall name PPPoE_IN rule 10 description 'Allow established/related sessions'
set firewall name PPPoE_IN rule 10 state established enable
set firewall name PPPoE_IN rule 10 state related enable
# 状態がestblished又はrelatedなパケットは通す。
set firewall name PPPoE_IN rule 20 action accept
set firewall name PPPoE_IN rule 20 description 'Allow IPv4 ICMP'
set firewall name PPPoE_IN rule 20 protocol icmp
# ICMPパケットは通す。
set firewall name PPPoE_IN rule 900 action drop
set firewall name PPPoE_IN rule 900 description 'Drop invalid state'
set firewall name PPPoE_IN rule 900 state invalid enable
# 状態がinvalidなパケットは破棄する。
set firewall name PPPoE_LOCAL default-action drop # PPPoE_LOCALチェインのデフォルトはパケットの破棄。
set firewall name PPPoE_LOCAL description 'IPv4 PPPoE to router' # GUIに表示されるチェインの説明。
set firewall name PPPoE_LOCAL enable-default-log # デフォルトアクションのログをとる。
set firewall name PPPoE_LOCAL rule 10 action accept
set firewall name PPPoE_LOCAL rule 10 description 'Allow established/related sessions'
set firewall name PPPoE_LOCAL rule 10 state established enable
set firewall name PPPoE_LOCAL rule 10 state related enable
# 状態がestblished又はrelatedなパケットは通す。
set firewall name PPPoE_LOCAL rule 20 action accept
set firewall name PPPoE_LOCAL rule 20 description 'Allow IPv4 icmp'
set firewall name PPPoE_LOCAL rule 20 protocol icmp
# ICMPパケットは通す。
set firewall name PPPoE_LOCAL rule 900 action drop
set firewall name PPPoE_LOCAL rule 900 description 'Drop invalid state'
set firewall name PPPoE_LOCAL rule 900 state invalid enable
# 状態がinvalidなパケットは破棄する。
set firewall receive-redirects disable # ICMPリダイレクトを無視する(中間者攻撃対策)
#set firewall ip-src-route disable # IPv4ソースルートオプション付きパケットを破棄する。 set interfaces ethernet eth0 pppoe 0 firewall in name PPPoE_IN
# PPPoE_INチェインをeth0ポートのpppoe0のインバウンドパケットに適用する。
set interfaces ethernet eth0 pppoe 0 firewall local name PPPoE_LOCAL
# PPPoE_LOCALチェインをeth0ポートのpppoe0からルータ宛のパケットに適用する。
設定の適用:
commit
save
確認:
show interfaces pppoe pppoe0でなにか表示されればOK。
NAPTの設定
set service nat rule 5010 description 'masquerade for WAN'
set service nat rule 5010 log disable
set service nat rule 5010 outbound-interface pppoe0
set service nat rule 5010 protocol all
set service nat rule 5010 type masquerade
show service natしたら一部は既に設定されていたので追加作業のみ。
PPPoEを通すパケットのポリシーベースルーティング(PBR)
PBR用のルーティングテーブルを用意:
set protocols static table 10 interface-route 0.0.0.0/0 next-hop-interface pppoe0
PBRするパケットのフィルタリング条件(radiko.jp宛の):
set firewall modify PBR1 description 'PBR filter'
set firewall modify PBR1 rule 100 action modify
set firewall modify PBR1 rule 100 description "To radiko.jp"
set firewall modify PBR1 rule 100 destination address 203.211.199.120
set firewall modify PBR1 rule 100 modify table 10
PBRをインターフェイスに適用する:
set interfaces switch switch0 firewall in modify PBR1
設定の適用:
commit
save
確認:
exit
show firewall modify PBR1 statistics
Dynamic DNSの設定
うちの独自ドメインはvalue-domainなんだが、ddclientにパッチを当てないとvalue-domainには対応しないみたいなので、とりまDuckDNSでやることに。
(2022-07-13)